package com.jt.travel.store.service;

import com.jt.travel.store.dao.TRouteMapper;
import com.jt.travel.store.pojo.TImg;
import com.jt.travel.store.pojo.TRoute;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class TRouteServiceImpl implements TRouteService{
    @Resource
    TRouteMapper tRouteMapper;
    @Override
    public Map getRouteListByPage(Integer currentPage, Integer pageSize, Integer category_id, String route_name) {
        List<TRoute> tRoutes = tRouteMapper.selectRouteBypage((currentPage - 1) * pageSize, pageSize, category_id, route_name);
        Map map=new HashMap();
        map.put("list",tRoutes);
        return map;
    }

    @Override
    public Integer selectRoutePageCount(Integer category_id, String route_name) {
       Integer count= tRouteMapper.selectRoutePageCount(category_id,route_name);
        return count;
    }

    @Override
    public Map getById(Integer id) {
        TRoute tRoute=tRouteMapper.getById(id);
        Map map=new HashMap();
        map.put("list",tRoute);
        return map;
    }

    @Override
    public Map getImgsById(Integer routeId) {
        List<TImg> img= tRouteMapper.getImgsById(routeId);
        Map map=new HashMap();
        map.put("list",img);
        return map;
    }
}
